/* 
 * File:   CrossoverOperators.h
 * Author: jcrada
 *
 * Created on April 7, 2009, 7:36 PM
 */

#ifndef _CROSSOVEROPERATORS_H
#define	_CROSSOVEROPERATORS_H

#include "GeneticOperators.h"


namespace jcrada {

    class RegularCrossover : public CrossoverOperator {
    public:
        virtual void crossover( TreeOfNodes& son, const TreeOfNodes& daughter );
    };

    class FairSizeCrossover : public CrossoverOperator {
    public:
        virtual void crossover( TreeOfNodes& son, const TreeOfNodes& daughter );
    };

    class RegularAndFairSizeCrossover : public CrossoverOperator {
    private:
        int _preferred_max_size;
        RandomGsl* _random_crossover_method;
        FairSizeCrossover _fair_size_crossover;
        RegularCrossover _regular_crossover;
    protected:

        virtual RandomGsl& getRandomCrossoverMethod( ) const {
            return *_random_crossover_method;
        }
    public:
        RegularAndFairSizeCrossover( int preferred_max_size );
        virtual ~RegularAndFairSizeCrossover( );
        virtual void crossover( TreeOfNodes& son, const TreeOfNodes& daughter );

        virtual void setPreferredMaxSize( int size ) {
            this->_preferred_max_size = size;
        }

        virtual int getPreferredMaxSize( ) const {
            return this->_preferred_max_size;
        }
    };

}

#endif	/* _CROSSOVEROPERATORS_H */

